Sequential Digits - Leetcode 1291 - Python